import java.awt.event.KeyEvent;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * mainWindow.java
 *
 * Created on May 11, 2011, 12:32:16 AM
 */
/**
 *
 * @author Ryan
 */
public class mainWindow extends javax.swing.JFrame {

    /** Creates new form mainWindow */
    public mainWindow() {
        initComponents();
        
        jLabelMissingHost.setVisible(false);
        jLabelMissingTo.setVisible(false);
        jLabelMissingFrom.setVisible(false);
        
        // hide the ability to set date initially
        jLabelSetDate.setVisible(false);
        jTextFieldMonth.setVisible(false);
        jTextFieldDay.setVisible(false);
        jTextFieldYear.setVisible(false);
        jTextFieldHour.setVisible(false);
        jTextFieldMinute.setVisible(false);
        
        // make the ability to set the from name hidden
        jLabelFromName.setVisible(false);
        jTextFieldFromName.setVisible(false);
        
    }
    
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane3 = new javax.swing.JScrollPane();
        jTextAreaMessage = new javax.swing.JTextArea();
        jLabel3 = new javax.swing.JLabel();
        jTextFieldFrom = new javax.swing.JTextField();
        jLabelMissingTo = new javax.swing.JLabel();
        jButtonSend = new javax.swing.JButton();
        jLabelMissingFrom = new javax.swing.JLabel();
        jTextFieldHost = new javax.swing.JTextField();
        jLabelMissingHost = new javax.swing.JLabel();
        jLabelTo = new javax.swing.JLabel();
        jTextFieldSubject = new javax.swing.JTextField();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTextAreaTo = new javax.swing.JTextArea();
        jLabelHost = new javax.swing.JLabel();
        jButtonClear = new javax.swing.JButton();
        jLabelFrom = new javax.swing.JLabel();
        jLabelMessage = new javax.swing.JLabel();
        jLabelSubject = new javax.swing.JLabel();
        jRadioButtonBuiltInAPI = new javax.swing.JRadioButton();
        jRadioButtonMailAPI = new javax.swing.JRadioButton();
        jLabelSetDate = new javax.swing.JLabel();
        jTextFieldMonth = new javax.swing.JTextField();
        jTextFieldDay = new javax.swing.JTextField();
        jTextFieldYear = new javax.swing.JTextField();
        jTextFieldHour = new javax.swing.JTextField();
        jTextFieldMinute = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextAreaResult = new javax.swing.JTextArea();
        jLabelResult = new javax.swing.JLabel();
        jLabelFromName = new javax.swing.JLabel();
        jTextFieldFromName = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Email Spoofer");

        jTextAreaMessage.setColumns(20);
        jTextAreaMessage.setRows(5);
        jTextAreaMessage.setText("Somthing or other!");
        jTextAreaMessage.setToolTipText("The content of the email");
        jScrollPane3.setViewportView(jTextAreaMessage);

        jLabel3.setText("Separate multiple email recipients with a semi-colon");

        jTextFieldFrom.setText("darthlobster@gmail.com");
        jTextFieldFrom.setToolTipText("Email address you want email to be from");

        jLabelMissingTo.setForeground(new java.awt.Color(255, 0, 0));
        jLabelMissingTo.setText("Who's it to?!");

        jButtonSend.setText("Send");
        jButtonSend.setToolTipText("Sends the email(s)...");
        jButtonSend.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSendActionPerformed(evt);
            }
        });

        jLabelMissingFrom.setForeground(new java.awt.Color(255, 0, 0));
        jLabelMissingFrom.setText("Who's it from?!");

        jTextFieldHost.setText("mail.insightbb.com");
        jTextFieldHost.setToolTipText("Email host server (a decent guess is email.<your internet service provider>.com). You should be able to find this online without much trouble.");

        jLabelMissingHost.setForeground(new java.awt.Color(255, 0, 0));
        jLabelMissingHost.setText("Missing host!");

        jLabelTo.setText("To:");
        jLabelTo.setToolTipText("The person/people you are emailing");

        jTextFieldSubject.setText("Hey!");
        jTextFieldSubject.setToolTipText("Subject of the email");

        jTextAreaTo.setColumns(20);
        jTextAreaTo.setLineWrap(true);
        jTextAreaTo.setRows(5);
        jTextAreaTo.setText("blinksumgreen@gmail.com");
        jTextAreaTo.setToolTipText("The person/people you are emailing");
        jTextAreaTo.setWrapStyleWord(true);
        jTextAreaTo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextAreaToKeyTyped(evt);
            }
        });
        jScrollPane4.setViewportView(jTextAreaTo);

        jLabelHost.setText("Host:");
        jLabelHost.setToolTipText("Email host server (a decent guess is email.<your internet service provider>.com). You should be able to find this online without much trouble.");

        jButtonClear.setText("Clear");
        jButtonClear.setToolTipText("Clears the form");
        jButtonClear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClearActionPerformed(evt);
            }
        });

        jLabelFrom.setText("From:");
        jLabelFrom.setToolTipText("Email address you want email to be from");

        jLabelMessage.setText("Message:");
        jLabelMessage.setToolTipText("The content of the email");

        jLabelSubject.setText("Subject:");
        jLabelSubject.setToolTipText("Subject of the email");

        jRadioButtonBuiltInAPI.setSelected(true);
        jRadioButtonBuiltInAPI.setText("Use Built in API Calls");
        jRadioButtonBuiltInAPI.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jRadioButtonBuiltInAPIMouseReleased(evt);
            }
        });

        jRadioButtonMailAPI.setText("Use Java Mail API calls");
        jRadioButtonMailAPI.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jRadioButtonMailAPIMouseReleased(evt);
            }
        });

        jLabelSetDate.setText("<html>\n<p>Set Sent Date:</p>\n<p>Month(1-12)\tDay\tYear\tHour\tMinute</p>\n</html>");
        jLabelSetDate.setToolTipText("Set the date the email will say it was sent (if any field is left empty, or entered incorrectly, it defaults to current time)");

        jTextAreaResult.setColumns(20);
        jTextAreaResult.setLineWrap(true);
        jTextAreaResult.setRows(5);
        jTextAreaResult.setWrapStyleWord(true);
        jScrollPane1.setViewportView(jTextAreaResult);

        jLabelResult.setText("Result");

        jLabelFromName.setText("Name:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(60, 60, 60)
                                    .addComponent(jButtonSend, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jButtonClear, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabelHost)
                                    .addGap(30, 30, 30)
                                    .addComponent(jTextFieldHost, javax.swing.GroupLayout.PREFERRED_SIZE, 518, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabelMissingHost)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 242, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabelTo)
                                    .addGap(40, 40, 40)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 518, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel3)))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabelFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jTextFieldFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabelMissingFrom)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabelFromName)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jTextFieldFromName))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabelSubject)
                                        .addGap(12, 12, 12)
                                        .addComponent(jTextFieldSubject, javax.swing.GroupLayout.PREFERRED_SIZE, 518, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabelMessage)
                                        .addGap(5, 5, 5)
                                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 518, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabelMissingTo))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabelResult)
                                    .addGap(138, 138, 138)))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(60, 60, 60)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelSetDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jRadioButtonBuiltInAPI)
                                .addGap(18, 18, 18)
                                .addComponent(jRadioButtonMailAPI))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jTextFieldMonth, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldDay, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldYear, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldHour, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldMinute, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 501, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(75, 75, 75))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButtonBuiltInAPI)
                    .addComponent(jRadioButtonMailAPI))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabelSetDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldMonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldDay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldHour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldMinute, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(jLabelHost))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabelMissingHost)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(33, 33, 33)
                                .addComponent(jLabelTo))
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(3, 3, 3)
                                .addComponent(jLabelFrom))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jTextFieldFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelFromName)
                                .addComponent(jTextFieldFromName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelMissingFrom)))
                        .addGap(21, 21, 21)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(3, 3, 3)
                                .addComponent(jLabelSubject))
                            .addComponent(jTextFieldSubject, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(13, 13, 13)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(71, 71, 71)
                                .addComponent(jLabelMessage))
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(54, 54, 54)
                        .addComponent(jLabelMissingTo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabelResult)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonSend, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonClear, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(70, 70, 70))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /*
     * Reset text fields and hide any visible warning labels
     */
    private void jButtonClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClearActionPerformed
        
        jTextFieldHost.setText("");
        jTextAreaTo.setText("");
        jTextFieldFrom.setText("");
        jTextFieldSubject.setText("");
        jTextAreaMessage.setText("");
        
        jLabelMissingHost.setVisible(false);
        jLabelMissingTo.setVisible(false);
        jLabelMissingFrom.setVisible(false);
        
        // clear date information
        jTextFieldMonth.setText("");
        jTextFieldDay.setText("");
        jTextFieldYear.setText("");
        jTextFieldHour.setText("");
        jTextFieldMinute.setText("");
        
        // clear results
        jTextAreaResult.setText("");
        
        // clear name
        jTextFieldFromName.setText("");
    }//GEN-LAST:event_jButtonClearActionPerformed

    private void jButtonSendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSendActionPerformed
        
        if(fieldsFilled() == true){
            
            String host = jTextFieldHost.getText();
            String to = jTextAreaTo.getText();
            String from = jTextFieldFrom.getText();
            String subject = jTextFieldSubject.getText();
            String message = jTextAreaMessage.getText();
            
            library l = new library();
            
            if(jRadioButtonBuiltInAPI.isSelected() == true){
                
                // we know the values aren't empty at this point,
                // so we go ahead and pass them
                String result = l.sendUsingBuiltInAPI(host, to, from, subject, message);
                
                jTextAreaResult.setText(result);
            }
            else{ // only other radio button is the mail API
                
                from = jTextFieldFromName.getText() + " <" + from + ">";
                
                String month = jTextFieldMonth.getText();
                String day = jTextFieldDay.getText();
                String year = jTextFieldYear.getText();
                String hour = jTextFieldHour.getText();
                String minute = jTextFieldMinute.getText();
                
                l.sendUsingMailAPI(host, to, from, subject, message, month, day, year, hour, minute);
            }
            
            jLabelMissingHost.setVisible(false);
            jLabelMissingTo.setVisible(false);
            jLabelMissingFrom.setVisible(false);
        }

    }//GEN-LAST:event_jButtonSendActionPerformed

    private void jTextAreaToKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextAreaToKeyTyped
        
        if(evt.getKeyCode() == KeyEvent.VK_TAB){
            jTextFieldFrom.requestFocusInWindow();
        }
    }//GEN-LAST:event_jTextAreaToKeyTyped

    private void jRadioButtonMailAPIMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButtonMailAPIMouseReleased
        jRadioButtonBuiltInAPI.setSelected(false);
        
        // make the ability to set the date available
        jLabelSetDate.setVisible(true);
        jTextFieldMonth.setVisible(true);
        jTextFieldDay.setVisible(true);
        jTextFieldYear.setVisible(true);
        jTextFieldHour.setVisible(true);
        jTextFieldMinute.setVisible(true);
        
        // make the ability to set the from name available
        jLabelFromName.setVisible(true);
        jTextFieldFromName.setVisible(true);
    }//GEN-LAST:event_jRadioButtonMailAPIMouseReleased

    private void jRadioButtonBuiltInAPIMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButtonBuiltInAPIMouseReleased
        jRadioButtonMailAPI.setSelected(false);
        
        // make sure the ability to set the date is hidden if they have this selected
        jLabelSetDate.setVisible(false);
        jTextFieldMonth.setVisible(false);
        jTextFieldDay.setVisible(false);
        jTextFieldYear.setVisible(false);
        jTextFieldHour.setVisible(false);
        jTextFieldMinute.setVisible(false);
        
        // make the ability to set the from name hidden
        jLabelFromName.setVisible(false);
        jTextFieldFromName.setVisible(false);
    }//GEN-LAST:event_jRadioButtonBuiltInAPIMouseReleased

    /*
     * Helper functions
     */
    private boolean fieldsFilled(){
        
        boolean readyToSend = true;
        
        if(jTextFieldHost.getText().trim().isEmpty()){
            
            jLabelMissingHost.setVisible(true);
            readyToSend = false;
        }
        else{
            jLabelMissingHost.setVisible(false);
        }
        
        if(jTextAreaTo.getText().trim().isEmpty()){
            
            jLabelMissingTo.setVisible(true);
            readyToSend = false;
        }
        else{
            jLabelMissingTo.setVisible(false);
        }
        
        if(jTextFieldFrom.getText().trim().isEmpty()){
            
            jLabelMissingFrom.setVisible(true);
            readyToSend = false;
        }
        else{
            jLabelMissingFrom.setVisible(false);
        }
        
        return readyToSend;
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new mainWindow().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonClear;
    private javax.swing.JButton jButtonSend;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabelFrom;
    private javax.swing.JLabel jLabelFromName;
    private javax.swing.JLabel jLabelHost;
    private javax.swing.JLabel jLabelMessage;
    private javax.swing.JLabel jLabelMissingFrom;
    private javax.swing.JLabel jLabelMissingHost;
    private javax.swing.JLabel jLabelMissingTo;
    private javax.swing.JLabel jLabelResult;
    private javax.swing.JLabel jLabelSetDate;
    private javax.swing.JLabel jLabelSubject;
    private javax.swing.JLabel jLabelTo;
    private javax.swing.JRadioButton jRadioButtonBuiltInAPI;
    private javax.swing.JRadioButton jRadioButtonMailAPI;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTextArea jTextAreaMessage;
    private javax.swing.JTextArea jTextAreaResult;
    private javax.swing.JTextArea jTextAreaTo;
    private javax.swing.JTextField jTextFieldDay;
    private javax.swing.JTextField jTextFieldFrom;
    private javax.swing.JTextField jTextFieldFromName;
    private javax.swing.JTextField jTextFieldHost;
    private javax.swing.JTextField jTextFieldHour;
    private javax.swing.JTextField jTextFieldMinute;
    private javax.swing.JTextField jTextFieldMonth;
    private javax.swing.JTextField jTextFieldSubject;
    private javax.swing.JTextField jTextFieldYear;
    // End of variables declaration//GEN-END:variables
}